using System;
using System.Diagnostics;

namespace AMFC{
	public class SystemLib{

		public static void LogEvent(Exception exc,object callee){
			LogEvent(callee,exc.Source+'\n'+exc.TargetSite+"\n"+exc.Message+"\n\n"+exc.StackTrace,EventLogEntryType.Error,48);
		}
		public static void LogEvent(Exception exc){
			LogEvent(exc.Source,exc.TargetSite+"\n"+exc.Message+"\n\n"+exc.StackTrace,EventLogEntryType.Error,48);
		}
		public static void LogEvent(object source,string msg,EventLogEntryType entryType,int code){
			LogEvent(source.GetType().Name,msg,entryType,code);
		}
		public static void LogEvent(string source,string msg,EventLogEntryType entryType,int code){
		try{
			EventLog log = new EventLog();
			log.Source = source;
			log.WriteEntry(msg,entryType,code);
		}catch(Exception){}
		}
		
	}
}
